home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
IRIX 6.2 Development Libraries
/
SGI IRIX 6.2 Development Libraries.iso
/
dist
/
complib.idb
/
usr
/
share
/
catman
/
p_man
/
cat3
/
complib
/
sscal2d.z
/
sscal2d
Wrap
Text File
|
1996-03-14
|
7KB
|
133 lines
ssssssssccccaaaallll2222dddd,,,,ddddssssccccaaaallll2222dddd((((3333FFFF)))) ssssssssccccaaaallll2222dddd,,,,ddddssssccccaaaallll2222dddd((((3333FFFF))))
NNNNAAAAMMMMEEEE
ssssssssccccaaaallll2222dddd,,,, ddddssssccccaaaallll2222dddd ---- scales 2D real sequence.
SSSSYYYYNNNNOOOOPPPPSSSSYYYYSSSS
_F_o_r_t_r_a_n :
ssssuuuubbbbrrrroooouuuuttttiiiinnnneeee ssssssssccccaaaallll2222dddd(((( nnnn1111,,,, nnnn2222,,,, aaaallllpppphhhhaaaa,,,, aaaarrrrrrrraaaayyyy,,,, llllddddaaaa))))
iiiinnnntttteeeeggggeeeerrrr nnnn1111,,,, nnnn2222,,,, llllddddaaaa
rrrreeeeaaaallll aaaallllpppphhhhaaaa,,,, aaaarrrrrrrraaaayyyy((((llllddddaaaa,,,,nnnn2222))))
ssssuuuubbbbrrrroooouuuuttttiiiinnnneeee ddddssssccccaaaallll2222dddd(((( nnnn1111,,,, nnnn2222,,,, aaaallllpppphhhhaaaa,,,, aaaarrrrrrrraaaayyyy,,,, llllddddaaaa))))
iiiinnnntttteeeeggggeeeerrrr nnnn1111,,,, nnnn2222,,,, llllddddaaaa
rrrreeeeaaaallll****8888 aaaallllpppphhhhaaaa,,,, aaaarrrrrrrraaaayyyy((((llllddddaaaa,,,,nnnn2222))))
_C :
####iiiinnnncccclllluuuuddddeeee <<<<fffffffftttt....hhhh>>>>
iiiinnnntttt ssssssssccccaaaallll2222dddd((((iiiinnnntttt nnnn1111,,,,iiiinnnntttt nnnn2222,,,,ffffllllooooaaaatttt aaaallllpppphhhhaaaa,,,,
ffffllllooooaaaatttt ****aaaarrrrrrrraaaayyyy,,,,iiiinnnntttt llllddddaaaa))));;;;
iiiinnnntttt ddddssssccccaaaallll2222dddd((((iiiinnnntttt nnnn1111,,,,iiiinnnntttt nnnn2222,,,,ddddoooouuuubbbblllleeee aaaallllpppphhhhaaaa,,,,
ddddoooouuuubbbblllleeee ****aaaarrrrrrrraaaayyyy,,,,iiiinnnntttt llllddddaaaa))));;;;
DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
ssssssssccccaaaallll2222dddd and ddddssssccccaaaallll2222dddd scale the 2D real sequence of N1xN2 sample.
The Fourier Transforms are not normalized so the succession Direct-
Inverse transform scales the input data by a factor equal to the size of
the transform. So ssssssssccccaaaallll2222dddd or ddddssssccccaaaallll2222dddd may be used to scale back the
result.
PPPPAAAARRRRAAAAMMMMEEEETTTTEEEERRRRSSSS
NNNN1111 Integer, the first dimension size of the 2D sequence.
Unchanged on exit.
NNNN2222 Integer, the second dimension size of the 2D sequence.
Unchanged on exit.
AAAAllllpppphhhhaaaa scaling floating point value.
AAAARRRRRRRRAAAAYYYY Array containing the samples of the 2D sequence to be transformed.
On input, the element {i,j} of the sequence is stored as A(i,j) in
_F_o_r_t_r_a_n , and A[i+j*lda] in _C.
On exit, the array is overwritten by its transform.
LLLLDDDDAAAA Integer, leading dimension: increment between the samples of two
consecutive sub-sequences (e.g between {i,j+1} and {i,j} ).
Unchanged on exit.
EEEExxxxaaaammmmpppplllleeee ooooffff CCCCaaaalllllllliiiinnnngggg SSSSeeeeqqqquuuueeeennnncccceeee
Working on 64x1024 2D sequence. We successively apply a Direct Fourier
Transform, an Inverse Fourier Transform and finally scale back the result
by a factor 1/N (1/(64*1024.))-
This sequence DirectFFT-InverseFFT-Scaling is equivalent to the identity
operator and the final sequence should be equal (with round-off
PPPPaaaaggggeeee 1111
ssssssssccccaaaallll2222dddd,,,,ddddssssccccaaaallll2222dddd((((3333FFFF)))) ssssssssccccaaaallll2222dddd,,,,ddddssssccccaaaallll2222dddd((((3333FFFF))))
precision) to the initial sequence.
The offset between the first element of two succesive sub-sequence
(leading dimension) is 1026 (1026 >= 1024+2).
_F_o_r_t_r_a_n
real array(0:1026-1,0:64-1), coeff((1024+15)+2*(64+15))
call scfft2dui( 1024, 64, coeff)
call scfft2du( -1, 1024, 64, array, 1026, coeff)
call csfft2du( 1, 1024, 64, array, 1026, coeff)
call sscal2d(1024,64,(1./real(1024*64)),array,1026)
_C
#include <fft.h>
float array[64*1026], *coeff;
coeff = scfft2dui( 1024, 64, NULL);
scfft2du( -1, 1024, 64, array, 1026, coeff);
csfft2du( 1, 1024, 64, array, 1026, coeff);
sscal2d( 1024,64,1./(float)(1024*64),array,1026);
NNNNOOOOTTTTEEEE____1111 :::: The Direct and Inverse transforms should use opposite signs -
Which one is used (+1 or -1) for Direct transform is just a matter of
convention-
NNNNOOOOTTTTEEEE____2222 :::: The Fourier Transforms are not normalized so the succession
Direct-Inverse transform scales the input data by a factor equal to the
size of the transform.
SSSSEEEEEEEE AAAALLLLSSSSOOOO
fft, scfft2dui, dzfft2dui, scfft2du, dzfft2du, csfft2du, zdfft2du,
sprod2du, dprod2du
PPPPaaaaggggeeee 2222